﻿using System.IO;

namespace Jinjia.Approve.Common.Extensions
{
    public static class PathExtension
    {
        /// <summary>
        /// 根据路径创建文件夹
        /// </summary>
        /// <param name="path">路径（支持文件夹）</param>
        /// <returns>文件夹路径</returns>
        public static string CreateDirectory(this string path)
        {
            if (string.IsNullOrWhiteSpace(path))
            {
                return "";
            }

            var directory = Path.GetDirectoryName(path);
            Directory.CreateDirectory(directory);
            return directory;
        }
    }
}